package com.gxa.web_admin.controller;

import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.R;
import com.gxa.modules.pojo.Contract;
import com.gxa.modules.service.ContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/contract")
public class ContractController {

    @Autowired
    private ContractService contractService;

    /**
     * 分页查询合同所有数据
     */
    @GetMapping("/findContractList")
    public JsonResult findContractList(Long currentPage, Long pageSize){
        return contractService.findContractList(currentPage,pageSize);
    }

    /**
     * 根据id查询合同信息
     * @return
     */
    @GetMapping("/queryContractById")
    public R queryContractById(Integer id){
        return contractService.queryContractById(id);
    }

    /**
     * 条件查询合同信息
     * @return
     */
    @GetMapping("/findContractListByCondition")
    public JsonResult findContractListByCondition(Long currentPage, Long pageSize, String customer_name, String signed_time){
        return contractService.findContractListByCondition(currentPage,pageSize,customer_name,signed_time);
    }
    /**
     * 添加纸质合同
     * @return
     */
    @PostMapping("/addContractPaper")
    public R addContractPaper(@RequestBody  Contract contract){
        return contractService.addContractPaper(contract);
    }

    /**
     * 添加电子合同
     * @return
     */
    @PostMapping("/addContractPw")
    public R addContractPw(@RequestBody Contract contract){
        return contractService.addContractPw(contract);
    }

    /**
     * 根据id删除合同信息
     * @return
     */
    @GetMapping("/delContractById")
    public R delContractById(Integer id){
        return contractService.delContractById(id);
    }

}
